home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: system() & error detection
- Date: Sat, 02 Mar 96 16:36:25 GMT
- Organization: none
- Message-ID: <825784585snz@genesis.demon.co.uk>
- References: <4gt24g$dba@ncar.ucar.edu> <313728B7.2112A121@eiffel.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <313728B7.2112A121@eiffel.com>
- guusl@eiffel.com "Guus Leeuw jr." writes:
-
- >According to the standard (references are listed with FAQ 19.27),
- >system() will return -1 upon execution error. Any other value is the
- >return code of the called program.
-
- Not true. The standard only defines the meaning of the return value of system
- when its argument is a null pointer (it returns nonzero if a command
- processor is available). When the argument is not a null pointer the return
- value is entirely implementation-defined. The standard makes no mention of
- the value -1.
-
- >The return code of the called program is what you return from main().
- >For examples `int main(){ return 1; }. The value 1 is the return code.
-
- This isn't guaranteed in general and isn't true is specific cases such as
- Unix.
-
- >The caller of this little program has to know how to interpret the
- >returned value.
-
- True. Unfortunately there is no system-independent way of doing this.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-